package com.justgame.project.service.just.service.basic;

import com.justgame.project.service.just.entity.JustGameScore;
import com.justgame.project.service.just.query.JustGameScoreQuery;
import com.justgame.project.service.just.wrapper.JustGameScoreWrapper;
import com.justgame.project.base.servcice.IBasicService;
import java.lang.Long;
import org.springframework.util.Assert;
import org.springframework.lang.NonNull;
import java.math.BigDecimal;

/**
 *
 * 游戏评分表服务自定义查询类
 *
 * @@tableName just_game_score
 * @author Zwb
 */
@SuppressWarnings("all")
public interface BasicJustGameScoreService extends IBasicService<JustGameScoreQuery,JustGameScore,JustGameScoreWrapper> {

   /**
    * 新增创建
    * @param gameInfoId 游戏信息
    * @param score 分数
    */
   default JustGameScore baseAdd(Long gameInfoId, BigDecimal score){
      JustGameScore justGameScore = new JustGameScore();
      justGameScore.setGameInfoId(safeValue(gameInfoId, null));
      justGameScore.setScore(safeValue(score, null));
      save(justGameScore);
      return justGameScore;
   }

   /**
    * 更新
    * @param gameInfoId 游戏信息
    * @param score 分数
    */
   default boolean baseUpdate(@NonNull JustGameScore justGameScore,Long gameInfoId, BigDecimal score){
      Assert.notNull(score,"必须提供分数");
      Assert.notNull(gameInfoId,"必须提供游戏信息");
      Assert.notNull(justGameScore.getId(),"必须提供主键ID");
      justGameScore.setGameInfoId(safeValue(gameInfoId, null));
      justGameScore.setScore(safeValue(score, null));
      return updateById(justGameScore);
   }

}